"""
管理员功能
"""
from core import src
from interface import admin_interface

#添加用户
def add_conut():
    src.regiter()

#修改用户额度
def change_blance():
    user_name = input("输入需要修改用户：")
    money = input("输入需要修改的金额：")
    falg,msg = admin_interface.change_blance(user_name,money)
    if falg:
        print(msg)
    else:
        print(msg)
#冻结用户
def lock_conut():
    user_name = input("输入需要被冻结的用户：")
    flag,msg = admin_interface.lock(user_name)
    if flag:
        print(msg)
    else:
        print(msg)


admin_dict={
        "1":add_conut,
        "2":change_blance, 
        "3":lock_conut,
}

def admin_run():
    while True:
        print("""
            选着一个功能：
            1:添加用户
            2:修改用户余额
            3:冻结用户
            """)
        choice = input("请输入一个功能")
        if choice not in admin_dict:
            print("请输入正确的编号")
            continue 
        admin_dict.get(choice)()